﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VentasTelcelMAC.Engine
{
    using VentasTelcelMAC.Model;
    using System.Data;

    public class PrepaidInfo : IGenericModel
    {
        private List<LocalSales> _localSales;
        private ExcelHandler excelImportExport;
        
        public PrepaidInfo()
        {
            _localSales = new List<LocalSales>();
            excelImportExport = new ExcelHandler();
        }
        public void  ExportToExcel()
        {
            throw new NotImplementedException();
        }
        public void ImportFromExcel()
        {
            excelImportExport.OpenExcelFile();
            MapValues();
            SQLhandlers.BulkInsert<LocalSales>("LocalSales", _localSales);          
        }

        private void MapValues()
        {
              DataSet DS =  excelImportExport.ExcelData;
              LocalSales ls = new LocalSales();
              CheckColumnsTypes(DS);
            //DS.Tables[0]

              foreach (DataRow row in DS.Tables[0].Rows)
              { 
                  foreach (DataColumn column in DS.Tables[0].Columns)
                  {
                      object item = row[column];
                  

                  }
              }

        }
        private void CheckColumnsTypes(DataSet DS)
        { 
            //checar numbers of fields
            // check types of each column

        }

    }
}
